﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.ComponentModel;
using System.Device.Location;


namespace GeoFinderClientApp.Model
{
     public class Friend : INotifyPropertyChanged
    {

        // The name of the friend.
        public string Name { get; set; }

        // The facebook unique id of the friend.
        public long ID { get; set; }

        private bool _isWhiteVisible;
        public bool IsWhiteVisible
        {
            get
            {
                return _isWhiteVisible;
            }
            set
            {
                _isWhiteVisible = value;
                RaisePropertyChanged("Changed visibility");
            }
        }

        private GeoCoordinate _position;
        public GeoCoordinate Position
        {
            get
            {
                return _position;
            }
            set
            {
                _position = value;
                RaisePropertyChanged("Moved");
            }
        }


        public event PropertyChangedEventHandler PropertyChanged;

        private void RaisePropertyChanged(string propertyName)
        {
            if (this.PropertyChanged != null)
            {
                this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }


        // Create a copy of an accomplishment to save.
        // If your object is databound, this copy is not databound.
        public Friend GetCopy()
        {
            Friend copy = (Friend)this.MemberwiseClone();
            return copy;
        }
    }

    public class TimeOutsOption : INotifyPropertyChanged
    {
        public TimeOutType Type { get; set; }

        private bool _automaticRefreshMode;
        public bool AutomaticRefreshMode
        {
            get
            {
                return _automaticRefreshMode;
            }
            set
            {
                _automaticRefreshMode = value;
                RaisePropertyChanged(Type + "RefreshModeModified");
            }
        }



        public event PropertyChangedEventHandler PropertyChanged;

        private void RaisePropertyChanged(string propertyName)
        {
            if (this.PropertyChanged != null)
            {
                this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }

        public TimeOutsOption GetCopy()
        {
            TimeOutsOption copy = (TimeOutsOption)this.MemberwiseClone();
            return copy;
        }

    }

    public enum TimeOutType
    {
        Facebook,
        Server,
        GPS
    }

    public class PushOption : INotifyPropertyChanged
    {

        public PushType Name { get; set; }
        private bool _isActive;
        public bool IsEnabled
        {
            get
            {
                return _isActive;
            }
            set
            {
                _isActive = value;
                RaisePropertyChanged(Name + "ActivationModified");
            }
        }

        public event PropertyChangedEventHandler PropertyChanged;

        private void RaisePropertyChanged(string propertyName)
        {
            if (this.PropertyChanged != null)
            {
                this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }

        public PushOption GetCopy()
        {
            PushOption copy = (PushOption)this.MemberwiseClone();
            return copy;
        }
    }
    
    public enum PushType
    {
        Push,
        Toast,
        Tile,
        Raw
    }

    public class SearchingAreaOption : INotifyPropertyChanged
    {
        // The name of the friend.
        public static readonly double MaxSerarchingArea = 40000;
        public static readonly double MinSerarchingArea = 0;


        private SearchingAreaType _type;
        public SearchingAreaType Type
        {
            get
            {
                return _type;
            }
            set
            {
                _type = value;
                RaisePropertyChanged("SearchingAreaTypeModified");
            }
        }

        private double _searchingArea;
        public double SearchingArea
        {
            get
            {
                return _searchingArea;
            }
            set
            {
                var tmp = value >= MinSerarchingArea ? value : MinSerarchingArea;
                tmp = tmp <= MaxSerarchingArea ? tmp : MaxSerarchingArea;
                _searchingArea = tmp;
                RaisePropertyChanged("SearchingAreaModified");
            }
        }

        public event PropertyChangedEventHandler PropertyChanged;

        private void RaisePropertyChanged(string propertyName)
        {
            if (this.PropertyChanged != null)
            {
                this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }

        public SearchingAreaOption GetCopy()
        {
            SearchingAreaOption copy = (SearchingAreaOption)this.MemberwiseClone();
            return copy;
        }

    }

    public enum SearchingAreaType
    {
        All
    }
}
